//
//  HEOrderDispatchCell.m
//  HealthFamily
//
//  Created by 吴欧 on 2020/10/28.
//  Copyright © 2020 honglutec. All rights reserved.
//

#import "HEOrderDispatchCell.h"

@interface HEOrderDispatchCell ()<UITextFieldDelegate>

@property(nonatomic, strong) UILabel *titleLb;
@property(nonatomic, strong) UITextField *textField;
@property(nonatomic, strong) UIImageView *arrowView;

@end

@implementation HEOrderDispatchCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
     if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
         self.selectionStyle = UITableViewCellSelectionStyleNone;
          [self initUI];
     }
     return self;;
 }

- (void)initUI {
    
    
    _titleLb = [UILabel new];
    _titleLb.font = DYBlodFont(16);
    _titleLb.text = @"立即指派";
    _titleLb.textColor = CNavLightBlackColor;
    [self.contentView addSubview:_titleLb];
    
    _textField = [[UITextField alloc]init];
    _textField.placeholder = @"扫描护工二维码";
    _textField.backgroundColor = [UIColor clearColor];
    _textField.font = DYFont(16);
    _textField.textAlignment = NSTextAlignmentLeft;
    _textField.delegate = self;
    _textField.userInteractionEnabled = NO;
    [self.contentView addSubview:_textField];
    
//    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tfClick)];
//    [self.contentView addGestureRecognizer:tap];
    
    _arrowView = [UIImageView new];
    _arrowView.contentMode = UIViewContentModeScaleAspectFill;
    _arrowView.image = IMAGE_NAMED(@"go_gray");
    [self.contentView addSubview:_arrowView];
    
    [_arrowView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.right.equalTo(self.contentView).mas_offset(-15);
        make.width.mas_offset(8);
        make.height.mas_offset(12);
    }];

     [_titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
         make.top.equalTo(self.contentView).mas_offset(20);
         make.left.equalTo(self.contentView).mas_offset(15);
      }];
    
    [_titleLb setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
    
    [_textField mas_makeConstraints:^(MASConstraintMaker *make) {
       make.top.equalTo(self.contentView).mas_offset(20);
        make.left.equalTo(_titleLb.mas_right).mas_offset(10);
        make.right.equalTo(_arrowView.mas_left).mas_offset(-10);
       make.bottom.equalTo(self.contentView).mas_offset(-20);
    }];
}

- (void)tfClick {
 
}

- (void)refreshContent:(GDFiterCellModel *)fiterModel formModel:(GDFormModel *)formModel indexPath:(NSIndexPath *)indexPath {
    _textField.text = formModel.order_staffName;
}

#pragma mark - delegate
- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField {
    return NO;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
